<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>订单预览</title>
    <link rel="stylesheet icon" type="text/css" href="${pageContext.request.contextPath}/admin/images/favicon.ico">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/car.css">

</head>
<body>
<!-- 导航条start -->
<%@include file="header.jsp" %>
<!-- 导航条end -->

<div class="container">
    <div class="toptitle col-xs-12 col-md-12 col-sm-12 col-lg-12">
        <span class="line"></span>
        <p style="display: inline-block; font-size: 20px;">订单预览<small>温馨提示：请添加你要邮递到的地址</small></p>
    </div>
    <form action="addOrder" method="get" onsubmit="return validate()">
        <div class="row" style="margin-top: 40px; font-size: 16px;">
            <input type="hidden" name="t" value="${type}">
            <div class="col-md-10 col-md-offset-1">
                <table class="table table-bordered table-striped table-hover">
                    <tr>
                        <th>序号</th>
                        <th>商品名称</th>
                        <th>价格</th>
                        <th>数量</th>
                        <th>小计</th>
                    </tr>
                    <c:set value="0" var="sum"></c:set>
                    <c:forEach items="${cartList}" var="c" varStatus="i">
                        <tr>
                            <th>${i.count}</th>
                            <th>${c.name}</th>
                            <th>${c.price}</th>
                            <th>${c.num}</th>
                            <th>${c.money}</th>
                        </tr>
                        <c:set var="sum" value="${sum+c.money}"></c:set>
                    </c:forEach>
                    <tr>
                        <td colspan="5">
                            <h5>收货地址</h5>
                            <select  id="addressValue" name="aid" style="width:60%" class="form-control">
                                <c:forEach items="${addList}" var="a" varStatus="ai">
                                    <option value="${a.id}">${a.name}&nbsp;&nbsp;${a.phone}&nbsp;&nbsp;${a.detail}</option>
                                </c:forEach>
                            </select>
                            <a href="myself_info.jsp">添加收货地址</a>
                        </td>
                    </tr>
                </table>
            </div>

        </div>
        <hr>
        <div class="row">
            <div style="margin-left: 40px;">
                <div style="font-size: 20px">商品金额总计：<b class="text-danger">￥&nbsp;&nbsp;<input type="text"
                                                                                               readonly="readonly"
                                                                                               name="total"
                                                                                               style="outline:none;border: none;"
                                                                                               value="${sum}"/></b>
                </div>
            </div>
        </div>
        <div class="row pull-right" style="margin-right: 40px;">
            <div style="margin-bottom: 20px;">
                <button id="btn_add" class="btn  btn-danger btn-lg" type="submit">提交订单</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script>
    function validate() {
        var addressValue = $("#addressValue").val();
        if (addressValue == null) {
            alert("收货地址不能为空，请填写收货地址");
            return false;
        }
    }
</script>
<!-- 页脚start -->
<%@include file="footer.jsp" %>
<!-- 页脚end -->
</body>
</html>